'\" te
.\"  Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH TELL 3C "Jan 28, 1998"
.SH NAME
tell \- return a file offset for a file descriptor
.SH SYNOPSIS
.LP
.nf
#include <unistd.h>

\fBoff_t\fR \fBtell\fR(\fBint\fR \fIfd\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBtell()\fR function obtains the current value of the file-position
indicator for the file descriptor \fIfd\fR.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBtell()\fR returns the current value of the
file-position indicator for \fIfd\fR measured in bytes from the beginning of
the file.
.sp
.LP
Otherwise, it returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
.SH ERRORS
.sp
.LP
The \fBtell()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEBADF\fR\fR
.ad
.RS 13n
The file descriptor \fIfd\fR is not an open file descriptor.
.RE

.sp
.ne 2
.na
\fB\fBEOVERFLOW\fR\fR
.ad
.RS 13n
The current file offset cannot be represented correctly in an object of type
\fBoff_t\fR.
.RE

.sp
.ne 2
.na
\fB\fBESPIPE\fR\fR
.ad
.RS 13n
The file descriptor \fIfd\fR is associated with a pipe or FIFO.
.RE

.SH USAGE
.sp
.LP
The \fBtell()\fR function is equivalent to \fBlseek(\fR\fIfd\fR\fB, 0,
SEEK_CUR)\fR.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR lseek (2),
.BR attributes (7)
